from volcenginesdkarkruntime import Ark

client = Ark(
    api_key="780242c1-b80a-43d1-b5a1-fcc5bea20248",
    base_url="https://ark.cn-beijing.volces.com/api/v3"
)


def generate_vue_component(prompt):
    response = client.chat.completions.create(
        model="deepseek-r1-250120",
        messages=[
            {"role": "system", "content": """你是一个全栈的架构师"""},
            {"role": "user", "content": prompt}
        ],
        stream=True
    )

    full_content = []
    for chunk in response:
        if chunk.choices:
            content = chunk.choices[0].delta.content
            if content:
                full_content.append(content)

    return "".join(full_content)
prompt="""
这是angularjs的菜单json数据，[{
            "id": "192916780820780183",
            "parentId": "192916780820201623",
            "name": "物业管理",
            "alias": "system.bms",
            "menuIcon": "fa-building",
            "open": 0,
            "sn": "4",
            "activeTab": null,
            "tabsStyle": null,
            "path": "-1.192916780820201623.192916780820780183",
            "href": null,
            "sysMethods": [],
            "children": [
                {
                    "id": "192916780820465815",
                    "parentId": "192916780820780183",
                    "name": "资源管理",
                    "alias": "system.resource",
                    "menuIcon": "fa-share-alt",
                    "open": 0,
                    "sn": "1",
                    "activeTab": null,
                    "tabsStyle": null,
                    "path": "-1.192916780820201623.192916780820780183.192916780820465815",
                    "href": null,
                    "sysMethods": [],
                    "children": [
                        
                        {
                            "id": "192916780820466839",
                            "parentId": "192916780820465815",
                            "name": "工程资源管理",
                            "alias": "system.resource_Engineering",
                            "menuIcon": null,
                            "open": 0,
                            "sn": "1",
                            "activeTab": null,
                            "tabsStyle": null,
                            "path": "-1.192916780820201623.192916780820465815.192916780820466839",
                            "href": null,
                            "sysMethods": [],
                            "children": [
                                {
                                    "id": "192916780820216983",
                                    "parentId": "192916780820466839",
                                    "name": "工程生成二维码",
                                    "alias": "system.resource_engineeringResourceQRCodes",
                                    "menuIcon": null,
                                    "open": 0,
                                    "sn": "0",
                                    "activeTab": null,
                                    "tabsStyle": null,
                                    "path": "-1.192916780820201623.192916780820465815.192916780820466839.192916780820216983",
                                    "href": null,
                                    "sysMethods": [],
                                    "children": [],
                                    "isParent": null,
                                    "check": null,
                                    "checked": 0,
                                    "isAllowTenant": "1",
                                    "menuUrl": "/engineeringResourceQRCodes",
                                    "templateUrl": "bms/views/resource/resourceBasicInfo/engineeringResourceQRCodes.html",
                                    "load": "[\n  {\n    serie: true,\n    files: [\n      'css/common.table.css',\n      'js/util/util.js',\n      'js/base/tableFixedHeight.js'\n    ]\n  },\n  {\n    name: 'resource',\n    files: ['bms/js/resource/EngresourceBasicInfoControllers.js']\n  }\n]",
                                    "enableMenu": 0,
                                    "isExtLink": null,
                                    "isOpenWindow": null,
                                    "extLinkParam": "0",
                                    "createOrgId": null,
                                    "type": "menu",
                                    "hasChildren": null,
                                    "pkVal": "192916780820216983"
                                }
                            ],
                            "isParent": null,
                            "check": null,
                            "checked": 0,
                            "isAllowTenant": "1",
                            "menuUrl": "/Engineering",
                            "templateUrl": "bms/views/resource/resourceBasicInfo/EngineeringResourceList.html",
                            "load": "[\n  {\n    serie: true,\n    files: [\n      'css/common.table.css',\n      'js/util/util.js',\n      'js/base/tableFixedHeight.js',\n      'css/plugins/zTree/metroStyle.css',\n                ]\n  },\n    {\n    name: 'resource',\n    files: ['bms/js/resource/EngresourceBasicInfoControllers.js']\n  },\n  {\n    insertBefore: '#loadBefore',\n    name: 'localytics.directives',\n    files: ['css/plugins/chosen/bootstrap-chosen.css','js/plugins/chosen/chosen.jquery.js','js/plugins/chosen/chosen.js']\n  }\n]",
                            "enableMenu": 1,
                            "isExtLink": null,
                            "isOpenWindow": null,
                            "extLinkParam": "0",
                            "createOrgId": null,
                            "type": "menu",
                            "hasChildren": null,
                            "pkVal": "192916780820466839"
                        }
                    ],
                    "isParent": null,
                    "check": null,
                    "checked": 0,
                    "isAllowTenant": "1",
                    "menuUrl": "/resource",
                    "templateUrl": "bms/views/common/content.html",
                    "load": null,
                    "enableMenu": 1,
                    "isExtLink": null,
                    "isOpenWindow": null,
                    "extLinkParam": "0",
                    "createOrgId": null,
                    "type": "menu",
                    "hasChildren": null,
                    "pkVal": "192916780820465815"
                }
            ]
}, {
            "id": "192916780820521111",
            "parentId": "192916780820201623",
            "name": "常用菜单",
            "alias": "system.common_use",
            "menuIcon": "fa fa-bar-chart",
            "open": 1,
            "sn": "1",
            "activeTab": null,
            "tabsStyle": null,
            "path": "null109993123534340195",
            "href": null,
            "sysMethods": [],
            "children": [],
            "isParent": null,
            "check": null,
            "checked": 0,
            "isAllowTenant": "1",
            "menuUrl": "/common_use",
            "templateUrl": "views/common/content.html",
            "load": "",
            "enableMenu": 1,
            "isExtLink": null,
            "isOpenWindow": null,
            "extLinkParam": "0",
            "createOrgId": null,
            "type": "menu",
            "hasChildren": null,
            "pkVal": "192916780820521111"
        }]，我现在需要将其使用js转换成若依用的菜单，如下所示：[{
        path: '/a/abc',
        component: 'Layout', // Layout 需要在 filterAsyncRouter 中解析
        children: [
          {
            path: '', // 让 `/abc` 直接匹配这个页面，不要 `index`
            component: 'abc.vue', // 保持和若依动态路由的格式一致
            name: 'Abc',
            meta: { title: '客户管理', icon: 'dashboard' }
          }
        ]
      },{
        path: '/b/bcd',
        component: 'Layout', // Layout 需要在 filterAsyncRouter 中解析
        children: [
          {
            path: '', // 让 `/abc` 直接匹配这个页面，不要 `index`
            component: 'bcd.vue', // 保持和若依动态路由的格式一致
            name: 'bcd',
            meta: { title: '用户管理', icon: 'dashboard' }
          }
        ]
      }]，注意，当菜单项有children说明有子菜单，而且只有当 "enableMenu": 1的才算菜单， "enableMenu": 0的不算，然后，菜单项中的menuUrl属性转换成path，templateUrl转换成component，如：
templateUrl: "views/dataClassification/resourceSysCategoryTree.html"转换成：component: 'views/dataClassification/resourceSysCategoryTree.vue', 
还有name转换成meta.title，alias转换成name，并且将load字符串(这个字符串不是标准json数据，需要特殊处理下)，转换成json并查看里面的对象元素，如果包含name属性且有 files属性，则把files转换到新属性meta.files位置，帮我使用js实现下
"""
code = generate_vue_component(prompt)
print("结果：\n")
print(code)
# ，并且templateUrl地址，对应的是当前目录下的html的地址，我们按照这个一级菜单和二级菜单新建文件夹和文件，文件夹名称就是alias中的值，如："alias": "system.resource_Engineering",那么文件夹名就是：resourceEngineering，文件名称就是这个文件名，如：'a/b/c.html'，那么组件就是c.vue，path='system/resourceEngineering'注意，我们在/Users/justinzhang/WorkSpace/com.ein/demo/angularjs2vue3/RuoYi-Vue/ruoyi-ui/src/views中新建文件夹和文件，
